<!-- 选择新增的流程 -->
<template>
	<el-dialog
		v-model="state.dialogVisible"
		title="关联附件下载"
		conter
		width="50%"
		:before-close="handleClose"
	>
		<!-- <el-button color="#FF7B50"  style="color: #fff" type="primary" @click="allDown">全部下载</el-button> -->
		<public-table
			class="m-t20"
			:index="true"
			:page="state.page"
			border
			:tableData="files"
			:isPaging="false"
			:tableOption.sync="state.tableOption"
		>
			<template #operation="scope">
				<!-- <span
              style="cursor: pointer;color: #fc7037"
              @click="toPath(scope.row)"
          >{{scope.row.operation}}</span> -->
				<el-button
					size="small"
					class="button_view"
					@click="handleDownload(scope.row)"
					type="primary"
					>下载</el-button
				>
			</template>
		</public-table>

		<template #footer>
			<span class="dialog-footer">
				<!-- <el-button type="primary"  @click="state.dialogVisible = false">
					提交
				</el-button> -->
			</span>
		</template>
	</el-dialog>
</template>

<script setup>
import { ref, reactive, watch, computed } from "vue";
import PublicTable from "@/components/PublicTable";
import { contractApi } from "@/api/biddingProject";
import { ElDialog, ElForm } from "element-plus";
import { fileCallback } from "@/api/common";

const props = defineProps({
	allNodes: {
		type: Object,
		required: true,
	},
	type: {
		type: String,
	},
	files: [],
});

const state = reactive({
	page: {
		total: 0,
		current: 1,
		size: 50,
	},
	tableOption: [
		{ label: "附件文件名称", prop: "fileName" },
		{ label: "文件大小", prop: "" },
		{ label: "操作", slot: true, prop: "operation" },
	],
	tableData: [{}],
	dialogVisible: false,
});

const emits = defineEmits([""]);
const updata = (row) => {
	emits("updataAddProcess", row);
	handleClose();
};

const handleClose = () => {
	state.dialogVisible = false;
};

const handleDownload = (row) => {
	fileCallback(row);
};

const allDown = () => {
	// props.files.map(v => {
	//   fileCallback(v)
	// })
};

// 开启弹窗
const open = () => {
	state.dialogVisible = true;
};

defineExpose({ open });
</script>

<style lang="scss" scoped>
:deep(.table-content) {
	max-height: 500px;
	overflow: auto;
}
</style>
